CREATE TABLE [dbo].[TransactionCharges]
(
[Id] [bigint] NOT NULL IDENTITY(1, 1),
[ChargeId] [int] NULL,
[DebitPartyId] [int] NULL,
[CreditPartyId] [int] NULL,
[TransactionId] [bigint] NULL,
[IsReversed] [int] NULL,
[Amount] [decimal] (18, 0) NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[TransactionCharges] ADD
CONSTRAINT [FK_TransactionCharges_Charges] FOREIGN KEY ([ChargeId]) REFERENCES [dbo].[Charges] ([Id])
GO
ALTER TABLE [dbo].[TransactionCharges] ADD CONSTRAINT [PK_TransactionCharge] PRIMARY KEY CLUSTERED  ([Id]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TransactionCharges] ADD CONSTRAINT [FK_TransactionCharge_Account] FOREIGN KEY ([CreditPartyId]) REFERENCES [dbo].[Accounts] ([Id])
GO
ALTER TABLE [dbo].[TransactionCharges] ADD CONSTRAINT [FK_TransactionCharge_Account1] FOREIGN KEY ([DebitPartyId]) REFERENCES [dbo].[Accounts] ([Id])
GO
ALTER TABLE [dbo].[TransactionCharges] ADD CONSTRAINT [FK_TransactionCharge_Transactions] FOREIGN KEY ([TransactionId]) REFERENCES [dbo].[Transactions] ([Id])
GO
